package com.cy.dda.web.front.diligencing;

import com.cy.dda.model.PageBean;
import com.cy.dda.model.Result;
import com.cy.dda.model.query.diligencing.DiligencingListQuery;
import com.cy.dda.model.vo.diligencing.DiligencingDetailVO;
import com.cy.dda.model.vo.diligencing.DiligencingListVO;
import com.cy.dda.service.diligencing.DiligencingService;
import com.cy.dda.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description 前台-尽调案件管理
 * @Author tanyilin
 * @Date 2019/5/31 17:18
 */
@RestController
@RequestMapping("/user/diligencing")
@Api(tags = "前台-尽调案件管理")
public class DiligencingController extends BaseController {

    @Autowired
    private DiligencingService diligencingService;

    @ApiOperation("尽调案件客户列表")
    @GetMapping("/get/list")
    public PageBean<DiligencingListVO> getList(DiligencingListQuery query) {

        query.setUserId(this.getUser().getUserId());
        PageBean<DiligencingListVO> pageBean = diligencingService.getDiligencingList(query);
        return pageBean;
    }

    @ApiOperation("尽调案件详情")
    @GetMapping("/get/detail")
    public Result<DiligencingDetailVO> getDiligencingDetail(@RequestParam(value = "diligencingId") Long diligencingId) {

        DiligencingDetailVO detailVO = diligencingService.getDiligencingDetail(diligencingId);
        return ok("获取尽调详情成功", detailVO);
    }

}
